package com.ktgj.train.api;

import com.ktgj.common.core.constant.ServiceNameConstants;
import com.ktgj.common.core.domain.R;
import com.ktgj.common.core.web.domain.AjaxResult;
import com.ktgj.train.api.domain.*;
import com.ktgj.train.api.factory.RemoteTrainFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 火车票服务
 * @author ruoyi
 */
@Repository
@FeignClient(contextId = "RemoteTrainService", value = ServiceNameConstants.Train_Service, fallbackFactory = RemoteTrainFallbackFactory.class)
public interface RemoteTrainService {
    /**
     * 查询12306常用联系人（远程调用）
     *
     * @param request
     * @return
     */
    @PostMapping("/trainTickets/contactQuerys")
    public TrContactQueryResponseApi contactQuerys(@RequestBody TrContactQueryRequestApi request);

    /**
     * 获取火车票指定座位价格
     * 9商务座  P特等座  M一等座  O二等座  6高级软卧  F动卧  4软卧  3硬卧
     * 2软座  E特等软座  1硬座  I一等卧  J二等卧  A高级动卧  5包厢硬卧
     * H一人软包  7一等软座  8二等软座  0无座  Q多功能座
     * @param price
     * @return
     */
    @PostMapping("/trainTickets/seatPrice")
    public BigDecimal seatPrice(@RequestBody SeatPriceApi price);

    /**
     * 查询会员火车票订单列表
     * */
    @PostMapping("/order/trainOrderNum")
    public List<TrainOrderApi> trainOrderNum(@RequestBody Map<String, Object> map);

    /**
     * 获取会员12306账号密码(CRM)
     */
    @PostMapping("/train/queryAccountIdCrm")
    public TrainAccountApi queryAccountIdCrm(@RequestBody Map<String, Object> map);

    /**
     * 查询会员下有多少笔火车票订单
     */
    @PostMapping("/order/queryTrainOrderNumber")
    public int queryTrainOrderNumber(@RequestBody Long customerId);

    /**
     * 行程火车票订单
     * */
    @PostMapping("/order/journeyTrainOrder")
    public JourneyTrainOrderVoApi journeyTrainOrder(@RequestBody Map<String, Object> map);

    /**
     * 获取火车站三字码
     * */
    @PostMapping("/trainstation/selectCityId")
    public String selectCityId(@RequestBody Map<String, Object> map);

    /**
     * 三字码获取城市名称
     * */
    @PostMapping("/trainstation/selectCityName")
    public TrainTrainstationApi selectCityName(@RequestBody Map<String, Object> map);

    /**
     * 获取城市代码、id、名称
     * */
    @PostMapping("/trainstation/cityVo")
    public CityVoApi cityVo(CityVoApi cityVoApi);

    /**
     * 获取订单详细信息
     */
    @PostMapping("/order/getInfo")
    public R<TrainOrder> getInfo(@RequestBody Map<String, Long> map);

    /**
     * 修改订单
     */
    @PostMapping("/order/edit")
    public R<AjaxResult> edit(@RequestBody TrainOrder trainOrder);

    /**
     * 查询退票记录列表
     * @param orderId
     * @param changeType
     * @return
     */
    @GetMapping("/orderRefundrecord/queryTrainOrderRefundrecordList")
    public List<TrainOrderRefundrecord> queryTrainOrderRefundrecordList(@RequestParam("orderId") Long orderId, @RequestParam("changeType") String changeType);

    /**
     * 火车票订单列表（CRM）
     * @param order
     * @return
     */
    @PostMapping("/order/orderList")
    public List<TrainOrderCRM> orderList(@RequestBody TrainCRMOrder order);

    /**
     * 订单号获取火车票订单信息
     * */
    @PostMapping("/order/orderNum")
    public TrainOrder orderNum(@RequestBody Map<String, Object> map);

    @PostMapping("/order/trainOrderListThings")
    public List<TrainOrder> orderListThings();
}
